﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PPARHistory.aspx.cs" Inherits="PPAP.Web.Part.PPARHistory" %>

<%@ Register TagPrefix="cc1" Namespace="PPAP.WebControls" Assembly="PPAP.WebControls" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function print(id) {
            url = "Report.aspx?rid=" + id;
            //            PopUpWindow(url, 230, 0, 880, 720);
            open(url, 'newwindow', 'height=720,width=880,top=0,left=230,toolbar=yes,menubar=yes,scrollbars=yes,resizable=no,location=no,status=no');
        }
    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <div>
        <font size='-1' color='gray'>Current position:Search>>PPAR search</font>
        <table width="800px" style="border-color: #2A48CE; border: 1px; border-style: solid;
            border-color: Gray; border-spacing: 0px;">
            <tr style="height: 32px;">
                <td style="font-weight: bold;" bgcolor="#D7D7D7" colspan="4">
                    &nbsp; PPAR search
                </td>
            </tr>
            <tr>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    &nbsp; Part No.:
                </td>
                <td>
                    <cc1:PartNo ID="txtPartno"  autocomplete="off"  Width="202px" runat="server" />
                </td>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    Part name:
                </td>
                <td>
                    <asp:TextBox ID="txtPartName" autocomplete="off"  runat="server" Width="202px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    &nbsp; Color:
                </td>
                <td>
                    <asp:TextBox ID="txtColor" autocomplete="off"  runat="server" Width="202px"></asp:TextBox>
                </td>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    Status:
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatus" runat="server" Width="208px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    &nbsp; Revision:
                </td>
                <td>
                    <asp:TextBox ID="tbVersion" autocomplete="off"  runat="server" Width="202px"></asp:TextBox>
                </td>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                  PPAR  Start date:
                </td>
                <td>
                    <cc1:My97 ID="DatePicker1" runat="server" Width="90px"></cc1:My97>
                    to:<cc1:My97 ID="DatePicker2" runat="server" Width="90px"></cc1:My97>
                </td>
            </tr>
            <tr>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    &nbsp; Plant:
                </td>
                <td>
                    <asp:DropDownList ID="ddlPlant" runat="server" Width="208px">
                    </asp:DropDownList>
                </td>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    Result:
                </td>
                <td>
                    <asp:DropDownList ID="ddlResult" runat="server" Width="208px">
                        <asp:ListItem Value="">All</asp:ListItem>
                        <asp:ListItem Value="G">GREEN - approved </asp:ListItem>
                        <asp:ListItem Value="Y">YELLOW - conditionally approved</asp:ListItem>
                        <asp:ListItem Value="R">RED - refused </asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    &nbsp; Supplier name:
                </td>
                <td>
                    <asp:TextBox ID="txtSuppliername" autocomplete="off"  runat="server" Width="202px"></asp:TextBox>
                </td>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    Supplier code:
                </td>
                <td>
                    <asp:TextBox ID="txtSuppliercode" autocomplete="off"  runat="server" Width="202px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                    &nbsp; PPAR No.:
                </td>
                <td>
                    <asp:TextBox ID="txtPPARNO" runat="server" autocomplete="off" Width="202px"></asp:TextBox>
                </td>
                <td style="width: 20%; font-weight: bold; color: #2E8AC5;">
                   Sample Card Start date:
                </td>
                <td>
                 <cc1:My97 ID="My1" runat="server" Width="90px"></cc1:My97>
                    to:<cc1:My97 ID="My2" runat="server" Width="90px"></cc1:My97>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="4">
                    <asp:CheckBox ID="cbAll" runat="server" Text="All versions" Visible="False" />
                </td>
            </tr>
            <tr style="height: 32px;">
                <td align="left" colspan="2"  style=" font-weight: bold; color: #2E8AC5;">
                    &nbsp; <asp:CheckBox ID="chkMycase" runat="server" Text="My case" />
                </td>
                <td align="center">
                    &nbsp;
                </td>
                <td align="right" style="padding-right: 30px;">
                    <asp:Button ID="btnSubmit" CssClass="button" runat="server" Text="Search" OnClick="btnSubmit_Click" />
                    &nbsp;
                    <asp:Button ID="btnExport" CssClass="button" runat="server" Text="Export" OnClick="btnExport_Click" />
                    <br />
                </td>
            </tr>
        </table>
        <br />
        <asp:DataGrid ID="dgList" HeaderStyle-BackColor="#2E8AC5" HeaderStyle-Font-Bold="true"
            HeaderStyle-Height="32px" Width="100%" OnLoad="dgLoad" AutoGenerateColumns="False"
            AllowSorting="true" runat="server" OnSortCommand="dgList_SortCommand">
            <Columns>
                <asp:BoundColumn DataField="rownum" HeaderText="SN" FooterText="SN">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="bdntpartno" FooterText="Part number" SortExpression="bdntpartno"
                    HeaderText="Part number">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="bdntpartname"  SortExpression="bdntpartname" HeaderText="Part name"
                    FooterText="Part name">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="color" SortExpression="color" HeaderText="Color" FooterText="Color">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="suppliercode" SortExpression="suppliercode" HeaderText="Supplier code"
                    FooterText="Supplier code">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="pparno" SortExpression="pparno" HeaderText="PPAR No."
                    FooterText="PPAR No.">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="PPARVERSION" Visible="false" HeaderText="PPAR version"
                    FooterText="PPAR version">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="qlevel" SortExpression="qlevel" HeaderText="Q/E level"
                    FooterText="Q/E level">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="bdntrevisionno" SortExpression="bdntrevisionno" HeaderText="Revision"
                    FooterText="Revision">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:TemplateColumn HeaderText="Status" FooterText="Status">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# ShowAuditStatus(Eval("status").ToString(),Eval("FINALSTATUS").ToString(),Eval("isinapp").ToString()) %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Status" FooterText="Status">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# ShowAuditStatus2(Eval("status").ToString(),Eval("isinapp").ToString()) %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Planned PPAR date" SortExpression="planedppardate"
                    FooterText="Planned PPAR date">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="lbendtime2" runat="server" Text='<%#Eval("planedppardate").ToString()==""?"":DateTime.Parse(Eval("planedppardate").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Part receiving date" SortExpression="receivedate"
                    FooterText="Part receiving date">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="lbendtime3" runat="server" Text='<%#Eval("receivedate").ToString()==""?"":DateTime.Parse(Eval("receivedate").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="PPAR Start date" SortExpression="pd" FooterText="PPAR Start date">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="lbppardate2" runat="server" Text='<%#Eval("pd").ToString()==""?"":DateTime.Parse(Eval("pd").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Sample Card Start date" SortExpression="ppardate" FooterText="Sample Card Start date">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="lbppardate" runat="server" Text='<%#Eval("ppardate").ToString()==""?"":DateTime.Parse(Eval("ppardate").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                 
                <asp:TemplateColumn HeaderText="PPAR End date" SortExpression="endtime" FooterText="PPAR End date">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <asp:Label ID="lbendtime" runat="server" Text='<%#Eval("endtime").ToString()==""?"":DateTime.Parse(Eval("endtime").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="FINALRESULT" HeaderText="Result" SortExpression="FINALRESULT"
                    FooterText="Result">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="qeuser" HeaderText="BDNT Q-engineer" SortExpression="qeuser"
                    FooterText="BDNT Q-engineer">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                </asp:BoundColumn>
                <asp:TemplateColumn HeaderText="Approval letter">
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    <ItemTemplate>
                        <img src="../Images/newimg/printer.png" title="Print" runat="server" visible='<%# Eval("status").ToString()=="7"?true:false %>'
                            onclick='<%#"javascript:print("+Eval("ID")+")" %>' />
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
                    HeaderText="View" FooterText="View">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButton1" CssClass="tt" ToolTip='view' PostBackUrl='<%# "SupplierPPARWeb.aspx?rid="+Eval("ID")+"&his=1" %>'
                            ImageUrl='../Images/newimg/see.png' runat="server" />
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
                    HeaderText="View" FooterText="View">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButton2" CssClass="tt" ToolTip='view' PostBackUrl='<%# "CreatPPARWeb.aspx?rid="+Eval("ID")+"&his=1" %>'
                            ImageUrl='../Images/newimg/see.png' runat="server" />
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
            <HeaderStyle BackColor="#E7E8E8" Font-Bold="True" Height="32px"></HeaderStyle>
        </asp:DataGrid>
        <webdiyer:AspNetPager ID="AspNetPager2" runat="server" ShowPageIndexBox="Always"
            CssClass="paginator" PageIndexBoxType="DropDownList" TextBeforePageIndexBox="goto"
            HorizontalAlign="Center" PageSize="20" EnableTheming="true" AlwaysShow="True"
            FirstPageText="|&lt;" LastPageText="&gt;|" NextPageText="&gt;" PrevPageText="&lt;"
            SubmitButtonText="Go" TextAfterPageIndexBox="page" InvalidPageIndexErrorMessage="Page index is not effective numerical！"
            OnPageChanged="AspNetPager2_PageChanged" PageIndexOutOfRangeErrorMessage="Page index beyond range"
            BackColor="#E7E8E8" Width="100%">
        </webdiyer:AspNetPager>
    </div>
    </form>
</body>
</html>
